﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

//Solution found on stackoverflow, to be able to add annotations even if the
//entity is generated newly again after an update.

namespace Chapter2Applications.Models
{
    [MetadataType(typeof(GuestResponseAnnotations))]
    public partial class GuestResponse
    {
        // No field here
    }

    internal sealed class GuestResponseAnnotations
    {
        public int GuestResponseId { get; set; }

        [Required(ErrorMessage = "Please enter your name")]  
        public string Name { get; set; }

        [Required(ErrorMessage = "Please enter your email address")]
        [RegularExpression(".+\\@.+\\..+", ErrorMessage = "Please enter a valid email address")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Please enter your phone number")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "Please specify whether you'll attend")]
        public Nullable<bool> WillAttend { get; set; }
    }
}